package com.xinzhi.service.impl;

import com.xinzhi.mapper.KouFenShenSuMapper;
import com.xinzhi.pojo.dto.KouFenShenSu;
import com.xinzhi.service.KouFenShenSuService;
import com.xinzhi.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class KouFenShenSuServiceImpl implements KouFenShenSuService {
    @Autowired
    private KouFenShenSuMapper kouFenShenSuMapper;

    /**
     * 特殊扣分申诉审核查询接口
     * @return
     */
    @Override
    public Result selectAl() {
        return Result.ok(kouFenShenSuMapper.selectKoushen());
    }


    /**
     * 特殊扣分申诉神哈根据年份查询接口
     * @param yearnumber
     * @return
     */
    @Override
    public Result selectKouByYearnumber(String yearnumber) {
        return Result.ok(kouFenShenSuMapper.selectKouByYearnumbersu(yearnumber));
    }


    /**
     * 特殊扣分申诉审核删除接口
     * @param reasonfor
     * @param deleted
     * @return
     */
    @Override
    public Result deleteupdate(String reasonfor, Integer deleted) {
        if (reasonfor == null && deleted == null){
            return Result.error("参数不能为空");
        }
        List<KouFenShenSu> deleteupdate = kouFenShenSuMapper.deleteupdate(reasonfor, deleted);
        return deleteupdate != null ? Result.ok("删除成功") : Result.error("删除失败");
    }
}
